/**
 * 系统登录
 */
import utils from 'service/utils';
import fetch from 'service/fetch';
/* ============================== */
let baseurl = './web/api/index.php?r=';
if (process.env.NODE_ENV !== 'production') {
  baseurl = '//v-test.wufae.com/ZGXYDSB/speech/web/api/index.php?r=dev-';
}
if (window.location.origin.indexOf('wufae') > -1) {
}
/* ========================== */
//$.get(baseurl+'sview');
/* ========================== */
var wxConfigUrl = baseurl + 'jssdk';
export default {
  vote(data) {
    return fetch(baseurl + 'default/vote', { type: 'post', data: data });
  },
  write(data) {
    return fetch(baseurl + 'default/write', { type: 'get', data: data });
  },
  getInit(data) {
    return fetch(baseurl + 'default/init', { type: 'get', data: data });
  },
  getWxSign(data) {
    return fetch('//v-test.wufae.com/wfapi/wechat/jssdk?url=' + encodeURIComponent(location.href.split('#')[0]), { type: 'get' }).then(function (res) {
      let config = res.data || {};
      config.debug = false;
      //config.jsApiList = ['onMenuShareTimeline', 'onMenuShareAppMessage'];
      config.jsApiList = ['onMenuShareTimeline', 'onMenuShareAppMessage', 'onMenuShareQQ'];
      wx.config(config);
      utils.initShareFunc();
    });
  }
};
